package com.warmlight.voicepacket.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.warmlight.voicepacket.R;
import com.warmlight.voicepacket.base.MBaseAdapter;
import com.warmlight.voicepacket.dbdata.DBFloatPlayListDetail;

import java.util.List;

/**
 * 悬浮框 播单列表中的音频列表
 * Created by jason on 2018/5/25.
 */

public class FloatPlayListDetailAdapter extends MBaseAdapter {

    public FloatPlayListDetailAdapter(Context context, List<DBFloatPlayListDetail> list) {
        super(context, list);
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        final ViewHolder holder;
        if (convertView != null) {
            holder = (ViewHolder) convertView.getTag();
        } else {
            convertView = View.inflate(mContext, R.layout.item_float_playlist_detail, null);
            holder = new ViewHolder();
            holder.tv_float_playlist_detail = (TextView) convertView.findViewById(R.id.tv_float_playlist_detail);
            holder.iv_float_playlist_detail_bg = (ImageView) convertView.findViewById(R.id.iv_float_playlist_detail_bg);
            convertView.setTag(holder);
        }

        holder.tv_float_playlist_detail.setText(((DBFloatPlayListDetail)mList.get(position)).getAudio_title());

        return convertView;
    }

    private class ViewHolder {
        TextView tv_float_playlist_detail;
        ImageView iv_float_playlist_detail_bg;
    }
}
